Skip to content

stop inlining config into pyo3-build-config; generate directly in pyo3-ffi#5862

Open
davidhewitt wants to merge 17 commits intoPyO3:mainfrom
davidhewitt:build-config-no-resolve
Open

stop inlining config into pyo3-build-config; generate directly in pyo3-ffi#5862
davidhewitt wants to merge 17 commits intoPyO3:mainfrom
davidhewitt:build-config-no-resolve

Conversation

@davidhewitt
Copy link
Copy Markdown
Member

This is an experiment to simplify pyo3-build-config to not have a build.rs itself, and let pyo3-build-config do the hard work. Instead, callers of pyo3-build-config APIs must themselves have a direct dependency on pyo3 or pyo3-ffi to pull information via env vars propagated by cargo.

I suspect that this will make integration of pyo3 with e.g. meson-python significantly easier, see e.g. mesonbuild/meson-python#721 (comment)

I also hope that it will enable faster CI; pyo3-build-config itself should now never need to rebuild when switching between abi3 / non-abi3.

@davidhewitt davidhewitt marked this pull request as ready for review April 30, 2026 10:44
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 30, 2026

Merging this PR will improve performance by 12.98%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 104 untouched benchmarks
⏩ 1 skipped benchmark1

Performance Changes

Benchmark BASE HEAD Efficiency
bench_pyclass_create 4.6 µs 4.1 µs +12.98%

Comparing davidhewitt:build-config-no-resolve (cf848fb) with main (9c734a1)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@davidhewitt
Copy link
Copy Markdown
Member Author

This is ready for review / merge. I think overall this makes the build configuration easier to reason about as the full configuration pipeline is run once in pyo3-ffi's build.rs.

As well as the simplification, this improves CI performance slightly because we reduce the number of rebuilds of pyo3-build-config. For example, the clippy/x86_64-unknown-linux-gnu/stable job takes about 9m 15s on main, and 8m 40s on this branch.

It is now possible for pyo3_build_config::get() to panic, whereas before it would probably always have succeeded. But I think in the cases it will now panic, it might not have been behaving consistently before due to possible warts with cross-compilation (see the changes in migration.md where I note this).

3.8 failure is unrelated in #6009
The coverage can be slightly better if we measure build scripts, done separately in #6007

@davidhewitt davidhewitt mentioned this pull request Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-build-full CI-no-fail-fast If one job fails, allow the rest to keep testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant